package com.neusoft.ch7.hw.test04;

public class HourlyEmployee extends ColaEmployee {
	// 属性
	// 时薪
	private double hourlySalary;
	// 月工作小时数
	private double monthHours;

	// 行为
	@Override
	public double getSalary(int month) {
		// 计算当前员工的月工资
		double monthSalary = 0.0;
		// 每月工作超出160 小时的部分按照1.5 倍工资发放
		if (monthHours > 160) {
			monthSalary = 160 * hourlySalary + (monthHours - 160) * hourlySalary * 1.5;
		} else {
			monthSalary = hourlySalary * monthHours;
		}
		return monthSalary + super.getSalary(month);
	}

	public HourlyEmployee(String empName, int empBirthdayMonth, double hourlySalary, double monthHours) {
		super(empName, empBirthdayMonth);
		this.hourlySalary = hourlySalary;
		this.monthHours = monthHours;
	}

}
